TICKER_CHECK_LIST = ['Spot.Binance.v1', 'Spot.Bithumb.v2', 'Spot.Gateio.v4',
                     'Spot.Gdax.v1', 'Spot.Huobi.v1', 'Spot.Kraken.v1',
                     'Spot.Mexc.v3', 'Spot.Okex.v5', 'Spot.Phemex.v1',
                     'Info.ExchangeRates.']


def kline_period_mapping(exchange, kline_period):
  binance_period_map = {'1m': '1m', '5m': '5m', '1h': '1h', '1d': '1d', '1W': '1w', '1M': '1M'}
  bybit_period_map = {'1m': '1', '5m': '5', '1h': '60', '1d': 'D', '1W': 'W', '1M': 'M'}
  coinmarketcap_period_map = {'1d': '24h', '1W': '7d', '1M': '30d'}
  coingecko_period_map = {'1d': '1d'}
  bitmex_period_map = {'1m': '1m', '5m': '5m', '1h': '1h', '1d': '1d'}
  okex_period_map = {'1m': '1m', '5m': '5m', '1h': '1H', '1d': '1D'}
  huobi_period_map = {'1m': '1min', '5m': '5min', '1h': '60min', '1d': '1day', '1M': '1mon'}
  upbit_period_map = {'1m': '1m', '5m': '5m', '1h': '60m', '1d': '1d'}
  gdax_period_map = {'1m': 60, '5m': 300, '1h': 3600, '1d': 86400}
  bithumb_period_map = {'1m': '1m', '5m': '5m', '1h': '1h', '1d': '24h'}
  kraken_period_map = {'1m': 1, '5m': 5, '1h': 60, '1d': 1440}
  ftx_period_map = {'1m': 60, '5m': 300, '1h': 3600, '1d': 86400}
  bitbank_period_map = {'1m': '1min', '5m': '5min', '30m': '30min','1h': '1hour', '12h': '12hour','1d': '1day', '1W': '1week', '1M': '1month'}
  gopax_period_map = {'1m': 1, '5m': 5, '30m': 30, '1d': 1440}
  dydx_period_map = {'1m': '1MIN', '5m': '5MINS', '30m': '30MINS', '1h': '1HOUR', '12h': '12HOURS', '1d': '1DAY'}
  if exchange == 'Binance':
    exchange_period_map = binance_period_map
  elif exchange == 'Bybit':
    exchange_period_map = bybit_period_map
  elif exchange == 'CoinMarketCap':
    exchange_period_map = coinmarketcap_period_map
  elif exchange == 'CoinGecko':
    exchange_period_map = coingecko_period_map
  elif exchange == 'Bitmex':
    exchange_period_map = bitmex_period_map
  elif exchange == 'Okex':
    exchange_period_map = okex_period_map
  elif exchange == 'Huobi':
    exchange_period_map = huobi_period_map
  elif exchange == 'Upbit':
    exchange_period_map = upbit_period_map
  elif exchange == 'Gdax':
    exchange_period_map = gdax_period_map
  elif exchange == 'Bithumb':
    exchange_period_map = bithumb_period_map
  elif exchange == 'Kraken':
    exchange_period_map = kraken_period_map
  elif exchange == 'Ftx':
    exchange_period_map = ftx_period_map
  elif exchange == 'Bitbank':
    exchange_period_map = bitbank_period_map
  elif exchange == 'Gopax':
    exchange_period_map = gopax_period_map
  elif exchange == 'Dydx':
    exchange_period_map = dydx_period_map
  else:
    raise NotImplementedError()
  return exchange_period_map.get(kline_period, None)
